import  instance from '@/utils/index'
// 轮播图部分
const  baanrList=()=>instance.post(`resources/carousel`)

// 手机部分
const phonelist=()=>instance.post(`product/getPromoProduct`,{categoryName:"手机"})

// 家电热门部分
const applist = ()=>instance.post(`product/getHotProduct`,{categoryName:["电视机", "空调", "洗衣机"]})

// 配件热门
const partlist =()=>instance.post(`product/getHotProduct`,{categoryName:["保护套", "保护膜", "充电器", "充电宝"]})

// 商品tab栏数据渲染
const tablist =()=>instance.post(`product/getCategory`)

// 请求所有的数据
const allslist =(obj)=>instance.post(`product/getAllProduct`,obj)

// 全部商品的tab内容接口
const getgoodstab = (from) =>instance.post(`product/getPromoProduct`,{categoryName:from})
// 注册
const getregister =(obj)=>instance.post(`users/register`,obj)

//商品详情数据
const getdetailed = (id) =>instance.post(`product/getDetails`,{productID:id})

// 商品详情轮播图数据
const getbaanr =(id) =>instance.post('product/getDetailsPicture',{productID:id})

// 登录
const getlogin =(obj)=>instance.post('users/login',obj)

// 加入购物车
const gwclist = (id,rid)=>instance.post(`user/shoppingCart/addShoppingCart`,{user_id:id,product_id:rid})

// 购物车数据
const  catelist = (id) =>instance.post(`user/shoppingCart/getShoppingCart`,{user_id:id})

// 删除购物车
const delgwc = (id,rid)=>instance.post(`user/shoppingCart/deleteShoppingCart`,{user_id:id,product_id:rid})

// 喜欢
const likelist = (id,rid)=>instance.post(`user/collect/addCollect`,{user_id:id,product_id:rid})

//我的收藏
const collcetion = (id) =>instance.post(`user/collect/getCollect`,{user_id:id})

//结算
const addorder = (arr,id) =>instance.post(`user/order/addOrder`,{producs:arr,user_id:id})
//我的订单
const myorder = (id) =>instance.post(`user/order/getOrder`,{user_id:id})

//搜索
const searchlist = (obj) =>instance.post(`product/getProductBySearch`,obj)
export { baanrList,phonelist, searchlist,addorder,myorder,likelist,catelist,applist,collcetion,partlist,tablist,allslist,getgoodstab,gwclist,getregister,getdetailed,getbaanr,getlogin,delgwc}